﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FlightClass
{
    class Program
    {
        static void Main(string[] args)
        {
            string ch="n";
            
            List<Flight> flights = new List<Flight>();
            
            do
            {
                Console.Clear();
                Flight newFlight = new Flight();
                newFlight.FillFlightInfo();
                flights.Add(newFlight);
                Console.WriteLine("Do you want to enter next flight? y/n");
                ch = Console.ReadLine().ToLower();
            } while (ch == "y");
            Console.Clear();
            Console.WriteLine("Search for destination point");
            Console.Write("Enter destination point: ");
            string userDestPoint = Console.ReadLine();
            foreach (var newFlight in flights)
            {
                if (newFlight.destPoint == userDestPoint)
               newFlight.PrintFlightInfo();
            }
        }

        class Flight
        {
            public string destPoint;
            public string planeModel;
            public string flightNumber;
            public string travelTime;

            public void FillFlightInfo()
            {
                Console.WriteLine("Flight info");
                Console.Write("Enter destination point: ");
                destPoint = Console.ReadLine();
                Console.Write("Enter flight number: ");
                flightNumber = Console.ReadLine();
                Console.Write("Enter plane model: ");
                planeModel = Console.ReadLine();
                Console.Write("Enter travel lime: ");
                travelTime = Console.ReadLine();
            }

            public void PrintFlightInfo()
            {
                Console.Clear();
                Console.WriteLine("Flight № {0} - Plane model {1} - Destination point {2} - Travel time {3}", flightNumber, planeModel, destPoint, travelTime);
            }

        }
    }
}
